feat(openai): 支持 Responses API 与自定义兼容 /v1 探测#111
feat(openai): 支持 Responses API 与自定义兼容 /v1 探测#111wenjiazhu wants to merge 3 commits intoErlichLiu:mainfrom
Conversation
Base URL 自动补全 /v1 + custom 探测 /models vs /v1/models
JiwaniZakir
left a comment
There was a problem hiding this comment.
In updateChannel (channel-manager.ts), when a channel's provider is switched to openai or custom, the effectiveApiFormat falls back via input.apiFormat ?? existing.apiFormat — but existing.apiFormat was undefined for the previous non-openai provider, leaving apiFormat silently unset after the transition. The caller would need to always supply an explicit apiFormat when changing provider type, which isn't enforced anywhere visible in this diff.
The testCustomOpenAICompatible function returns resolvedBaseUrl in the ChannelTestResult, which is a useful signal, but nothing in the diff shows the test result's resolvedBaseUrl being persisted back to the channel config. If the user runs a connectivity test and /v1 gets auto-detected, the channel's stored baseUrl won't actually be updated — so subsequent requests from agent-orchestrator.ts would still use whatever the user originally typed, relying on normalizeOpenAIBaseUrl being called at runtime rather than at configuration time.
Also worth noting: the ensureV1: boolean = false parameter added to testOpenAICompatible is passed as true only for provider === 'openai', meaning providers like deepseek and moonshot still use normalizeBaseUrl instead of normalizeOpenAIBaseUrl. If those providers also serve under /v1, this inconsistency could silently affect test reliability for those channels.
apiFormat(chat_completions/responses),OpenAI 默认切到responses,OpenAI 兼容默认chat_completionsOpenAIAdapter同时支持/chat/completions与/responses:构建instructions/扁平tools/转录文本输入,并解析 Responses SSE(meta(responseId)、response.output_text.delta、工具调用事件)previous_response_id续接;若 Responses 流未返回responseId自动降级为chat_completions继续streamSSE聚合responseId并保证done事件只触发一次,避免重复完成信号custom:连接测试与模型拉取并发探测/models与/v1/models(将401/403视作端点存在信号),自动回填规范化 Base URLby wenjiazhu@gmail.com